<template>
	<u-modal :value="value" :show-title="false" :content="lang_order[type + 'Tips']" show-cancel-button
		:cancel-text="lang_common.cancel" :confirm-text="lang_common.done"
		:confirm-color="'#FD1E43'" @confirm="submitAction" z-index="9999999" @cancel="cancelAction()">
	</u-modal>
</template>

<script>
	import { orderConfirmReceipt, orderCancel, orderDelete } from '@/api/user/order.js'
	import { refundCancel } from '@/api/user/saled.js'
	export default {
		props: {
			value: {
				default: false
			},
			orderNumber: {
				default: ''
			},
			type: {
				default: ''
			}
		},
		methods: {
			// 弹窗事件执行后
			submitAction() {
				let key = this.type
				switch(key) {
					case 'confrimExtend':
						this.changeAction(orderConfirmReceipt)
						break;
					case 'cancelOrder':
						this.changeAction(orderCancel)
						break;
					case 'deleteOrder':
						this.changeAction(orderDelete)
						break;
					case 'cancelApply':
						this.changeAction(refundCancel)
						break;
					default:
					break;
				}
			},
			changeAction(fn) {
				fn({ orderNumber: this.orderNumber }).then(() => {
					this.$emit('change')
					this.cancelAction()
				})
			},
			cancelAction() {
				this.$emit('input', false)
			}
		}
	}
</script>

<style>
</style>
